home *** CD-ROM | disk | FTP | other *** search
- Front end features of MacPerl Matthias Neeracher 03Dec94
-
- This file describes features only present in the MacPerl application, which
- are not directly related to the language itself.
-
- 1. USER INTERFACE
-
- This area is notoriously underdocumented. I can't give more than hints at the moment
- (I have a standing offer to write decent manuals if anybody researches and writes my
- PhD thesis for me :-):
-
- a) Online Help
-
- Selecting any perl operator and choosing Help from the Help menu (That's the question
- mark icon on the right side of the menubar) will give you chapter and verse from the
- Perl manual page.
-
- If you turn on Balloon Help and point at a Perl operator, a balloon will give you
- a summary of parameters to the operator.
-
- a) Menus
-
- MacPerl for the most part tries to behave like a typical primitive text editor.
- "Format" in the Edit menu presents a choice of text fonts and sizes. "Preferences"
- controls many settings, the most important of which is a list of library folders.
-
- "Jump to╔" in the Edit menu allows to pop up files and lines based on the current
- selection. The following formats are supported:
-
- Format Example
- /File\s+["']([^"']+)["']\D*(\d+)/i File "om:mani:padme:hum", Line 23
- /["']([^"']+)["']\D*(\d+)/ "om:mani:padme:hum", Line 23
- /["']([^"']+)["']/ "om:mani:padme:hum"
- /.+/ om:mani:padme:hum
-
- 2. PACKAGES
-
- A MacPerl file can be saved in various forms, depending on what you choose
- from the popup menu in the "Save As..." dialog:
-
- - A plain text file. These can be opened from any text editor or word processor.
- - A droplet. This combines the script and some glue code into a "Mini-application".
- These will automatically run when double-clicked from the finder, and all files
- you drop on them in the Finder will appear in the @ARV array.
- - A runtime. While they in some respects behave like droplets, they are much more
- heavyweight and will set you back several 100K every time you save one. The
- advantage of runtimes is that they run without the MacPerl application.
- - Any other packaging you could think of. A MacHTTP package will appear in a few
- days. The release verson of MacPerl 4.1.4 will describe how to add packaging
- options to MacPerl.
-
- 3. APPLEEVENTS/APPLESCRIPT
-
- MacPerl has been scriptable and recordable since version 4.1.0. Most AppleEvents
- supported are the fairly conventional text events you'll find in the Scriptable
- Text Editor. In fact, MacPerl should support pretty much the same text manipulations
- as STE, except that STE generates somewhat prettier scripts when being recorded. If
- you find something working in STE and not in MacPerl, talk to me about it!
-
- The only two events that are somewhat special to MacPerl are Save and Do Script.
-
- Event: Save [core/save]
- Direct parameter: A window object reference [obj ], a file [fss ], or text [TEXT]
- "in" [dest] (opt): A file [fss ] to save in.
- "as" [fltp] (opt): A save type [svas] (standard types are Text [TEXT], Droplet [SCPT]
- and System 7 runtime [MrP7] or an enumeration cast to [svas]).
-
- This event does the same as the core save event, but it can also save files not open
- at the time and even on-the-fly text, and it can save in any package available. This
- is useful to e.g. save a file as a MacPerl droplet from another application.
-
- Event: "Do Script" [misc/dosc]
- Direct parameter: A file [fss ], text [TEXT] or a list of files and text.
- Reply: Text results, depending on mode.
- "extract" [EXTR] (opt): A boolean [bool] which when false prevents searching for a #! line.
- "debug" [DEBG] (opt):A boolean which when true runs the Perl debugger
- "mode" [MODE] (opt): A mode [MODE], one of Local [LOCL], Batch [BATC], Remote [RCTL].
- "environment" [ENVT] (opt): A list of text [TEXT] variable/value pairs to add to the
- environment.
- [SASE] (opt): A record used as a callback event for remote mode.
-
- As opposed to the standard "Do Script" event, MacPerl's "Do Script" accepts a list as
- the direct parameter and stuffs all further elements into @ARGV. The mode parameter
- has a major influence on the way the script is executed:
-
- - Local mode is the default. The script just runs and only returns text if you call
- &MacPerl'Reply().
- - Batch mode redirects standard output and error to the reply apple event. Standard
- output is put into the direct parameter of the reply, while standard error is
- put into element [diag] of parameter [OUTP].
- - Remote control mode returns immediately from the DoScript request. Clients are
- then expected to communicate with MacPerl with "Send Data" [McPL/DATA] events.
- These contain standard input in the direct parameter and output as explained
- above. Furthermore, the 'WANT' parameter of the reply contains enumeration codes
- for all input descriptors awaiting input. Sending a null descriptor with any
- code signals an end of file for that file. If you did specify a SASE parameter
- in your Do Script or Send Data events, it will be sent back to you the next
- time MacPerl waits for input.
- - Both Batch and Remote control mode support opening further input and output
- streams as "Dev:AEVT:[4 byte code]". Standard input/output is "Dev:AEVT", standard
- error is "Dev:AEVT:diag". Note that these names are case sensitive!
-
- Furthermore, you can specify environment settings which will show up in %ENV in the
- environment parameter. If you specify a value for "PERLLIB", the library folders
- specified in the "Preferences╔" dialog are appended to the value you specify.
-